package com.test;

import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

import com.alibaba.fastjson.JSONObject;
import com.paas.base.modules.utils.net.http.HttpUtil;

public class PermissionService {

	public static String getBaseURI() {
		return "http://127.0.0.1:8081/menurolepermission/1.0.0/permission";
//		return "http://192.168.0.119:19687/menurolepermission/1.0.0/permission";
	} 
	public static void find() throws IOException{
		String id = "gway0000767dh5df39shdyn19adt1yt6k9cygwru";
		
		String vo = HttpUtil.get(getBaseURI()+"/get/permission/"+id,new HashMap<String,String>() );
		System.out.println(JSONObject.toJSONString(vo));
	}
	
	public static void delete() throws IOException{
		Map<String,Object> paramMap = new HashMap<String,Object>();
		paramMap.put("ids", Arrays.asList(new String[]{"aa","bb"}));
		String vo = HttpUtil.postFormParams(getBaseURI(), "/delete", paramMap);
		System.out.println(vo);
	}
	
	public static void page() throws IOException{
		Map<String,Object> paramMap = new HashMap<String,Object>();
		paramMap.put("appId","1");
		paramMap.put("pageNo", 1);
		paramMap.put("pageSize", 3);
		String vo = HttpUtil.postFormParams(getBaseURI(), "/query/page", paramMap);
		System.out.println(vo);
	}
	
	public static void queryByUserApp()throws IOException{
		Map<String,Object> paramMap = new HashMap<String,Object>();
		paramMap.put("appId","gway0000769dg3034hpkmhhaaqum2zyqpcnubrty");
		paramMap.put("userId", "gway000076e4fb72h52tqerpaunezvtdsgrieecf");
		paramMap.put("permissionType", "0");
		String vo = HttpUtil.postFormParams(getBaseURI(), "/queryByUserApp", paramMap);
		System.out.println(vo);
	}
	public static void main(String[] args) throws IOException {
//		find();
//		delete();
//		page();
		queryByUserApp();
	}
}
